import unittest

from Base.AirtestLib import uuid_report, only_auto_setup
from Base.ConstPool import DEVICE1
from Common.utils.com_utils import AirTaskData
from airtest.core.api import *


class BaseCase(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        # 初始化设备
        only_auto_setup(__file__, devices=[
            DEVICE1
        ])


class TemplateCase(BaseCase):
    @uuid_report("安装并启动", title="基础用例", author="v.panyzh")
    def test_0_init(self):
        package_path = AirTaskData['package_path']
        package_name = AirTaskData['package_name']

        # 安装应用
        install(package_path, install_options=["-r", "-t"])
        sleep(1)
        # 启动应用
        start_app(package_name)

    @classmethod
    def tearDownClass(cls):
        # 关闭应用
        package_name = AirTaskData['package_name']
        stop_app(package_name)
        uninstall(package_name)
